<?php

/**
 * Template filter form base class.
 *
 * @package    campaign_generation
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseTemplateFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'name'                      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'deleted'                   => new sfWidgetFormFilterInput(),
      'footer_id'                 => new sfWidgetFormFilterInput(),
      'show_comments'             => new sfWidgetFormFilterInput(),
      'comment_header'            => new sfWidgetFormFilterInput(),
      'comment_login_description' => new sfWidgetFormFilterInput(),
      'comment_button_caption'    => new sfWidgetFormFilterInput(),
      'show_rating'               => new sfWidgetFormFilterInput(),
      'rate_txt'                  => new sfWidgetFormFilterInput(),
      'rating_sorting_id'         => new sfWidgetFormFilterInput(),
      'alias_when_footer'         => new sfWidgetFormFilterInput(),
      'include_api_code'          => new sfWidgetFormFilterInput(),
      'search_str'                => new sfWidgetFormFilterInput(),
      'search_types'              => new sfWidgetFormFilterInput(),
      'search_results_count'      => new sfWidgetFormFilterInput(),
      'include_weather_api'       => new sfWidgetFormFilterInput(),
      'weather_target'            => new sfWidgetFormFilterInput(),
      'include_maps_api'          => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'name'                      => new sfValidatorPass(array('required' => false)),
      'deleted'                   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'footer_id'                 => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'show_comments'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'comment_header'            => new sfValidatorPass(array('required' => false)),
      'comment_login_description' => new sfValidatorPass(array('required' => false)),
      'comment_button_caption'    => new sfValidatorPass(array('required' => false)),
      'show_rating'               => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'rate_txt'                  => new sfValidatorPass(array('required' => false)),
      'rating_sorting_id'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'alias_when_footer'         => new sfValidatorPass(array('required' => false)),
      'include_api_code'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'search_str'                => new sfValidatorPass(array('required' => false)),
      'search_types'              => new sfValidatorPass(array('required' => false)),
      'search_results_count'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'include_weather_api'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'weather_target'            => new sfValidatorPass(array('required' => false)),
      'include_maps_api'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('template_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Template';
  }

  public function getFields()
  {
    return array(
      'id'                        => 'Number',
      'name'                      => 'Text',
      'deleted'                   => 'Number',
      'footer_id'                 => 'Number',
      'show_comments'             => 'Number',
      'comment_header'            => 'Text',
      'comment_login_description' => 'Text',
      'comment_button_caption'    => 'Text',
      'show_rating'               => 'Number',
      'rate_txt'                  => 'Text',
      'rating_sorting_id'         => 'Number',
      'alias_when_footer'         => 'Text',
      'include_api_code'          => 'Number',
      'search_str'                => 'Text',
      'search_types'              => 'Text',
      'search_results_count'      => 'Number',
      'include_weather_api'       => 'Number',
      'weather_target'            => 'Text',
      'include_maps_api'          => 'Number',
    );
  }
}
